package vue;

import modele.Joueur;

/**
 *
 * @author gervaila
 */
public final class InfosJoueur extends InfosPanel {

	/**
	 * Creates new form InfosJoueur
	 */
	public InfosJoueur() {
		initComponents();
	}

	/**
	 * Crée un info panel de jeu pour le joueur 'joueur'
	 *
	 * @param joueur le joueur concerné par ce panel
	 * @param aire l'aire de jeu
	 */
	public InfosJoueur(Joueur joueur, AireDeJeu aire) {
		super(joueur, aire);
		initComponents();
		couleurJoueurPanel.setBackground(joueur.getCouleurOpaque());
		nomJoueur.setText(joueur.getNom());
		actualiserPanel();
	}

	@Override
	public void actualiserPanel() {
		nbActionsLabel.setText(joueur.getNbCoupsRestants() + " / 6");
		nbPionsLabel.setText("" + joueur.getPions().size());
		finTourBoutton.requestFocus();
	}

	/**
	 * This method is called from within the constructor to initialize the form.
	 * WARNING: Do NOT modify this code. The content of this method is always
	 * regenerated by the Form Editor.
	 */
	@SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        nomJoueur = new javax.swing.JLabel();
        panelInfoPion3 = new javax.swing.JPanel();
        image3 = new javax.swing.JLabel();
        jPanel5 = new javax.swing.JPanel();
        jSeparator6 = new javax.swing.JSeparator();
        nom5 = new javax.swing.JLabel();
        nbActionsLabel = new javax.swing.JLabel();
        jPanel9 = new javax.swing.JPanel();
        jSeparator7 = new javax.swing.JSeparator();
        nom9 = new javax.swing.JLabel();
        nbPionsLabel = new javax.swing.JLabel();
        jSeparator10 = new javax.swing.JSeparator();
        couleurJoueurPanel = new javax.swing.JPanel();
        finTourBoutton = new javax.swing.JButton();

        nomJoueur.setText("Joueur :");

        image3.setMaximumSize(new java.awt.Dimension(50, 50));
        image3.setMinimumSize(new java.awt.Dimension(50, 50));
        image3.setPreferredSize(new java.awt.Dimension(50, 50));

        jSeparator6.setOrientation(javax.swing.SwingConstants.VERTICAL);

        nom5.setText("Actions");

        nbActionsLabel.setText("6 / 6");

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addComponent(nom5, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(1, 1, 1)
                .addComponent(jSeparator6, javax.swing.GroupLayout.PREFERRED_SIZE, 12, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(nbActionsLabel)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jSeparator6, javax.swing.GroupLayout.DEFAULT_SIZE, 15, Short.MAX_VALUE)
                    .addComponent(nom5)
                    .addComponent(nbActionsLabel))
                .addContainerGap())
        );

        jSeparator7.setOrientation(javax.swing.SwingConstants.VERTICAL);

        nom9.setText("Nb Pions");

        nbPionsLabel.setText("D");

        javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9);
        jPanel9.setLayout(jPanel9Layout);
        jPanel9Layout.setHorizontalGroup(
            jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel9Layout.createSequentialGroup()
                .addComponent(nom9, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(1, 1, 1)
                .addComponent(jSeparator7, javax.swing.GroupLayout.PREFERRED_SIZE, 12, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(nbPionsLabel)
                .addContainerGap(30, Short.MAX_VALUE))
        );
        jPanel9Layout.setVerticalGroup(
            jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel9Layout.createSequentialGroup()
                .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jSeparator7, javax.swing.GroupLayout.DEFAULT_SIZE, 15, Short.MAX_VALUE)
                    .addComponent(nom9)
                    .addComponent(nbPionsLabel))
                .addContainerGap())
        );

        javax.swing.GroupLayout panelInfoPion3Layout = new javax.swing.GroupLayout(panelInfoPion3);
        panelInfoPion3.setLayout(panelInfoPion3Layout);
        panelInfoPion3Layout.setHorizontalGroup(
            panelInfoPion3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelInfoPion3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(panelInfoPion3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jPanel9, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jSeparator10, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 168, Short.MAX_VALUE)
                    .addComponent(jPanel5, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addGap(306, 306, 306)
                .addComponent(image3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
        );
        panelInfoPion3Layout.setVerticalGroup(
            panelInfoPion3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelInfoPion3Layout.createSequentialGroup()
                .addGroup(panelInfoPion3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(image3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(panelInfoPion3Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jSeparator10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jPanel9, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );

        couleurJoueurPanel.setBackground(new java.awt.Color(255, 0, 0));
        couleurJoueurPanel.setPreferredSize(new java.awt.Dimension(15, 15));

        javax.swing.GroupLayout couleurJoueurPanelLayout = new javax.swing.GroupLayout(couleurJoueurPanel);
        couleurJoueurPanel.setLayout(couleurJoueurPanelLayout);
        couleurJoueurPanelLayout.setHorizontalGroup(
            couleurJoueurPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 15, Short.MAX_VALUE)
        );
        couleurJoueurPanelLayout.setVerticalGroup(
            couleurJoueurPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 15, Short.MAX_VALUE)
        );

        finTourBoutton.setText("Fin du tour");
        finTourBoutton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                finTourBouttonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(panelInfoPion3, javax.swing.GroupLayout.PREFERRED_SIZE, 173, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(couleurJoueurPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(nomJoueur))
                    .addComponent(finTourBoutton))
                .addContainerGap(39, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(couleurJoueurPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(nomJoueur, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(panelInfoPion3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(finTourBoutton)
                .addContainerGap())
        );
    }// </editor-fold>//GEN-END:initComponents

	private void finTourBouttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_finTourBouttonActionPerformed
		aire.getEcouteur().joueurSuivant();
	}//GEN-LAST:event_finTourBouttonActionPerformed
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel couleurJoueurPanel;
    private javax.swing.JButton finTourBoutton;
    private javax.swing.JLabel image3;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel9;
    private javax.swing.JSeparator jSeparator10;
    private javax.swing.JSeparator jSeparator6;
    private javax.swing.JSeparator jSeparator7;
    private javax.swing.JLabel nbActionsLabel;
    private javax.swing.JLabel nbPionsLabel;
    private javax.swing.JLabel nom5;
    private javax.swing.JLabel nom9;
    private javax.swing.JLabel nomJoueur;
    private javax.swing.JPanel panelInfoPion3;
    // End of variables declaration//GEN-END:variables
}
